<template>
  <div class='container'>
    <el-dialog title="预览文章" :visible="showPreviewDialog" @close="close" width="800px">
      <div class="title">
        <h2>{{ articleDetail.title }}</h2>
        <div>
          <span>{{ articleDetail.createTime | formatDate }}</span>
          <span>{{ articleDetail.creatorID === 2 ? '超级管理员' : '录入管理员' }}</span>
          <i class="el-icon-view"></i>
          <span>{{articleDetail.visits}}</span>
        </div>
      </div>
      <div class="content" v-html="articleDetail.articleBody"></div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    showPreviewDialog: {
      type: Boolean,
      default: false
    },
    articleDetail: {
      type: Object,
      default: () => {}
    }

  },
  methods: {
    close() {
      this.$emit('update:showPreviewDialog', false)
    }
  }
}
</script>

<style scoped >

.title div span {
  padding: 5px;
}
.title h2{
  margin-top: 0;
  margin-bottom: 5px;
  padding: 0;
}
.content{
  margin-top: 10px;
  padding: 10px;
  /* background: yellowgreen; */
  background: #f5f5f5;
  border-top: 1px dashed #ccc;
}
</style>
